﻿namespace CSharpPro._1013;

public class demo4
{
    public static void Test4()
    {
        for (int num = 2; num < 1000; num++)
        {
            int sum = 0;
            for (int i = 1; i < num; i++)
            {
                if (num % i == 0)
                {
                    sum += i;
                }
            }
            if (sum == num)
            {
                Console.Write(num + "的真因子为: ");
                for (int i = 1; i < num; i++)
                {
                    if (num % i == 0)
                    {
                        Console.Write(i + " ");
                    }
                }
                Console.WriteLine();
            }
        }
    }
}